import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AnalysisVO, AnalysisForm, AnalysisQuery } from '@/api/system/analysis/types';

/**
 * 查询气体分析列表
 * @param query
 * @returns {*}
 */

export const listAnalysis = (query?: AnalysisQuery): AxiosPromise<AnalysisVO[]> => {
  return request({
    url: '/system/analysis/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询气体分析详细
 * @param id
 */
export const getAnalysis = (id: string | number): AxiosPromise<AnalysisVO> => {
  return request({
    url: '/system/analysis/' + id,
    method: 'get'
  });
};

/**
 * 新增气体分析
 * @param data
 */
export const addAnalysis = (data: AnalysisForm) => {
  return request({
    url: '/system/analysis',
    method: 'post',
    data: data
  });
};

/**
 * 修改气体分析
 * @param data
 */
export const updateAnalysis = (data: AnalysisForm) => {
  return request({
    url: '/system/analysis',
    method: 'put',
    data: data
  });
};

/**
 * 删除气体分析
 * @param id
 */
export const delAnalysis = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/analysis/' + id,
    method: 'delete'
  });
};
